<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="./assets/lib/cropper/cropper.css">
    <style>
        .container {
            width: 600px;
            height: 500px;
            float: left;
        }

        img {
            width: 100%;
        }

        .preview-box {
            float: left;
        }

        .preview {
            border: 1px solid #000;
            background-color: #ccc;
            margin: 20px;
            overflow: hidden;
        }

        .w200 {
            width: 200px;
            height: 200px;
        }

        .w100 {
            width: 100px;
            height: 100px;
        }

        .w50 {
            width: 50px;
            height: 50px;
        }

        .w30 {
            width: 30px;
            height: 30px;
        }
    </style>
</head>

<body>

    <div class="container">
        <img src="./assets/images/sample2.jpg">
    </div>

    <!-- 预览区域 -->
    <div class="preview-box">
        <div class="preview w200"></div>
        <div class="preview w100"></div>
        <div class="preview w50"></div>
        <div class="preview w30"></div>
    </div>

    <script src="./assets/lib/jquery.js"></script>
    <script src="./assets/lib/cropper/Cropper.js"></script>
    <script src="./assets/lib/cropper/jquery-cropper.js"></script>

    <script>
        let $image = $(".container img");

        $image.cropper({
            // 纵横比
            aspectRatio: 1,
            // 指定预览区域 (把预览的图片放到哪去)
            preview: ".preview",
        });
    </script>

</body>

</html>